<% if action_name == "new" %>
<p> Use this form to select from existing Manufacturers list</p>
	<%= form_for(@manufacturer, url:drug_manufacturers_path) do |fr| %>
			<div class="field">
				<strong>Manufacturer</strong><br>
				<%= fr.collection_select(:id, Manufacturer.all, :id, :name, prompt: true) %>
			</div>
			<div class="actions">
				<%= button_to "Existing Manufacturer", action: "create" %>
			</div>
		<% end %>
<p> Or you can use form below to add new manufacturer into the list</p>
<% end %>


<%= form_for(@manufacturer, url:
		if action_name == "new"
			drug_manufacturers_path
		else
			drug_manufacturer_path
		end
	) do |f| %>
  <% if @manufacturer.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@manufacturer.errors.count, "error") %> prohibited this manufacturer from being saved:</h2>

      <ul>
      <% @manufacturer.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :code %><br>
    <%= f.text_field :code %>
  </div>
  <div class="field">
    <%= f.label :website %><br>
    <%= f.text_field :website %>
  </div>
  <div class="field">
    <%= f.label :address %><br>
    <%= f.text_area :address %>
  </div>
  <div class="field">
    <%= f.label :email %><br>
    <%= f.text_field :email %>
  </div>
  <div class="field">
    <%= f.label :phone %><br>
    <%= f.text_field :phone %>
  </div>
  <div class="field">
    <%= f.label :fax %><br>
    <%= f.text_field :fax %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
